import axios from './index'
export const getAll = async (current,size,type,value) => {
    let res = await axios({
        method:"get",
        url:'/api/products',
        params:{
            current,size,type,value
        }
    });
    return res.data;
}

export const add = async (student) => {
    let res = await axios({
        method:"post",
        url:'/api/products',
        data:{...student}

    });
    return res.data;
}

export const getById = async (id) => {
    let res = await axios({
        method:"get",
        url:'/api/products/' + id,

    });
    return res.data;
}

export const update = async (product) => {
    let res = await axios({
        method:"put",
        url:'/api/products/' + product._id,
        data:{...product}

    });
    return res.data;
}